
<div class='_line'></div>
<div >
    <b><a href="#" style='font-size:1.5rem;color:black;'>活动 </a></b>&nbsp;&nbsp;&nbsp;&nbsp;
    <b><a href="<?php echo shop_buildUrl('/user/coupon/check');?>" style='font-size:1.5rem;color:black;' >优惠劵 </a></b>
</div>

<div class='_line'></div>
<div class='_cut2' ></div>
<div id='content'>
<?php foreach($actions as $k=>$v){ ?>
<?php if($k%3==0){ ?>
<div class='row'>
    <?php }?>
    <div class='col-sm-3 col-md-4 full'>
        <div class='thumbnail' style="margin-bottom:10px">
            <div style="height:12rem;overflow: hidden;">
                <a target="_blank" href="<?php echo buildUrl('/user/action/info');?>&aid={$v.id}&model_type={$v.model_type}">
                    <?php if(!empty($v['img'])){ ?>
                    <img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN_.$v['img'][0]; ?>" style='width:49.5%;float:left;height:12rem;'/>
                    <img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN_.$v['img'][1]; ?>" style='width:49.5%;float:right;height:12rem;'/>
                    <?php  }else{  ?>
                    <img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN_.'/upload/action.jpg'; ?>" style='width:49.5%;float:left;height:12rem;'/>
                    <img class='_img' src="<?php echo 'http://'.IMAGE_DOMAIN_.'/upload/action.jpg'; ?>" style='width:49.5%;float:right;height:12rem;'/>   
                    <?php } ?>
                </a>    
            </div>
        </div>
        <div class='caption' style='overflow: hidden'>
            <span style="margin-left: 6px">
                <a class='_a' href="<?php echo buildUrl('/user/action/info');?>&aid={$v.id}&model_type={$v.model_type}">{$v.action_name}</a>
            </span>
            <div>
                <span style="margin-left: 6px">参加人数：<?php echo $v['num'];?></span>
                <span style="margin-left: 6px">活动状态：<?php if( $v['model_type'] == 1 ){ echo "拼团"; }elseif( $v['model_type'] == 2 ){ echo "拼颜值"; }elseif( $v['model_type'] == 3 ){ echo "公益"; } ?> 进行中 </span>
            </div>
        </div>
    </div>
    <?php if(($k+1)%3==0 || $actions[$k+1]['id']<1){ ?>
</div>
<?php } ?>
<?php } ?>
</div>
<div class="clear"></div>
<script type='text/javascript'>
    var number = 12;
    function loaddata()
    {
        if(number ==-1){
            return;
        }
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
        store_id = "<?php echo (int)$_GET['store_id'];  ?>";
        if ($(document).height() <= totalheight)
        {
            $.ajax({ url: "/user/action/append?start="+number+"&store_id="+store_id,async:true, success: function(msg){
                    if(msg == 'false'){
                        number = -1;
                        return ;
                    }
                    var html = "";
                    msg = eval('(' + msg + ')');
                    $.each(msg,function(i,v){
                        if(i%4==0){
                            html += "<div class='row'>";
                        }
                        html += "<div class='col-sm-3 col-md-4 full'>";
                        html += "<div class='thumbnail' style='margin-bottom:10px'>";
                        html += "<div style='height:12rem;overflow: hidden'>";
                        html += "<a target='_blank' href='<?php echo buildUrl('/user/action/info',$barber_id);?>&aid=";
                        html += v.id;
                        html += "'>";
                        if(v.img){ 
                            html += "<img class='_img' src='";
                            html += "<?php echo 'http://'.IMAGE_DOMAIN_; ?>";
                            html += v.img[0];
                            html += "' style='width:49.5%;float:left;height:12rem;'/>";
                            html += "<img class='_img' src='";
                            html += "<?php echo 'http://'.IMAGE_DOMAIN_; ?>";
                            html += v.img[1];
                            html += "' style='width:49.5%;float:right;height:12rem;'/>";
                        }else{
                            var img = "<?php echo 'http://'.IMAGE_DOMAIN_.'/upload/action.jpg'; ?>";
                            html += "<img class='_img' src='";
                            html += img;
                            html += "' style='width:49.5%;float:left;height:12rem;'/>";
                            html += "<img class='_img' src='";
                            html += img;
                            html += "' style='width:49.5%;float:right;height:12rem;'/>";
                        }
                        html += "</a></div></div><div class='caption'><span style='margin-left: 6px'><a class='_a' href='<?php echo buildUrl('/user/action/info',$barber_id);?>&aid=";
                        html += v.id;
                        html += "'>";
                        html += v.action_name;
                        html += "</a></span>";
                        html += '<div><span style="margin-left: 6px">参加人数：';
                        html += v.num;        
                        html += '</span><span style="margin-left: 6px">活动状态：';
                        html += '进行中';        
                        html += "</span></div></div></div>";
                        if((i+1)%3==0){
                            html += "</div>";
                        }
                        number += 1;
                    });
                    $('#content').append(html);
            }});
            $("#container").append(text);
        }
    }

    $(window).scroll(function () {
        loaddata();
    });
</script>